home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form RASDial
- Caption = "RASDial"
- ClientHeight = 5385
- ClientLeft = 1620
- ClientTop = 2205
- ClientWidth = 8175
- Height = 5790
- Left = 1560
- LinkTopic = "RASDial"
- LockControls = -1 'True
- ScaleHeight = 5385
- ScaleWidth = 8175
- Top = 1860
- Width = 8295
- Begin VB.Frame Frame3
- Caption = "Phone Book"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1095
- Left = 240
- TabIndex = 10
- Top = 2160
- Width = 5055
- Begin VB.TextBox txtPhoneBook
- Height = 285
- Left = 240
- TabIndex = 13
- Top = 360
- Width = 2895
- End
- Begin VB.CommandButton cmdRefresh
- Caption = "Refresh"
- Height = 495
- Left = 3240
- TabIndex = 12
- Top = 360
- Width = 1575
- End
- End
- Begin VB.Frame Frame2
- Caption = "Connect State"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1815
- Left = 240
- TabIndex = 4
- Top = 3360
- Width = 5055
- Begin VB.ListBox lstConnectState
- Height = 1230
- ItemData = "RASDial.frx":0000
- Left = 240
- List = "RASDial.frx":0002
- TabIndex = 5
- Top = 360
- Width = 4575
- End
- End
- Begin VB.Frame Frame1
- Caption = "Phone Book Entries"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1935
- Left = 240
- TabIndex = 0
- Top = 120
- Width = 5055
- Begin VB.ListBox lstEntries
- Height = 1425
- ItemData = "RASDial.frx":0004
- Left = 240
- List = "RASDial.frx":0006
- TabIndex = 3
- Top = 360
- Width = 2895
- End
- Begin VB.CommandButton cmdConnect
- Caption = "Connect"
- Enabled = 0 'False
- Height = 495
- Left = 3240
- TabIndex = 2
- Top = 360
- Width = 1575
- End
- Begin VB.CommandButton cmdDisconnect
- Caption = "Disconnect"
- Enabled = 0 'False
- Height = 495
- Left = 3240
- TabIndex = 1
- Top = 960
- Width = 1575
- End
- End
- Begin RasLib.mRAS mRAS1
- Left = 7560
- Top = 4800
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 64
- PhoneBook = ""
- PhoneNumber = ""
- LogonName = ""
- LogonPassword = ""
- CallbackNumber = ""
- EntryName = ""
- Domain = ""
- Blocking = 0 'False
- End
- Begin VB.Label lblRefresh
- Caption = $"RASDial.frx":0008
- Height = 975
- Left = 5400
- TabIndex = 11
- Top = 2280
- Width = 2535
- End
- Begin VB.Label lblConnecting
- Caption = $"RASDial.frx":009E
- Height = 1455
- Left = 5400
- TabIndex = 9
- Top = 3480
- Visible = 0 'False
- Width = 2535
- End
- Begin VB.Label lblDisconnect
- Caption = "You are now connected to the server. When you are done, press the Disconnect button and RAS will hang-up the phone (Disconnect)."
- Height = 855
- Left = 5400
- TabIndex = 8
- Top = 960
- Visible = 0 'False
- Width = 2535
- End
- Begin VB.Label lblConnect
- Caption = $"RASDial.frx":0170
- Height = 1455
- Left = 5400
- TabIndex = 7
- Top = 600
- Visible = 0 'False
- Width = 2535
- End
- Begin VB.Label lblSelect
- Caption = "Listed to the left are all the entries in the current phone book. Select one of the phone book entries."
- Height = 615
- Left = 5400
- TabIndex = 6
- Top = 240
- Visible = 0 'False
- Width = 2535
- End
- Attribute VB_Name = "RASDial"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub DisableControl(C As Control)
- ' Prevent flashing by changing the
- ' state only if needed
- If C.Enabled <> False Then
- C.Enabled = False
- End If
- End Sub
- Private Sub EnableControl(C As Control)
- ' Prevent flashing by changing the
- ' state only if needed
- If C.Enabled = False Then
- C.Enabled = True
- End If
- End Sub
- Private Sub HideControl(C As Control)
- ' Prevent flashing by changing the
- ' state only if needed
- If C.Visible <> False Then
- C.Visible = False
- End If
- End Sub
- Sub LoadEntries()
- Dim I
- lstEntries.Clear
- ' Load the phone book entries list with
- ' the current list of entries from the
- ' RAS control
- For I = 0 To mRAS1.EntryCount - 1
- lstEntries.AddItem mRAS1.EntryList(I)
- Next I
-
- ShowControl lblSelect
- End Sub
- Private Sub ShowControl(C As Control)
- ' Prevent flashing by changing the
- ' state only if needed
- If C.Visible = False Then
- C.Visible = True
- End If
- End Sub
- Private Sub cmdConnect_Click()
- On Error Resume Next
- ' Use the entry selected by the user
- mRAS1.EntryName = lstEntries.Text
- mRAS1.GetEntry
- 'When using NT, the phonebook property
- 'must be set. If an error occurs opening
- 'the phonebook, prompt for the phonebook file.
- If Err > 20620 And Err < 20626 Then
- Dim TempStr As String
- TempStr = "If using NT, the Phonebook property must be set." & vbCr & vbCrLf
- TempStr = TempStr & "The default system phonebook for NT 4.0 is" & vbCrLf
- TempStr = TempStr & Chr$(34) & "C:\WINNT\SYSTEM32\RAS\RASPHONE.PBK" & Chr$(34) & vbCr & vbCrLf
- TempStr = TempStr & "The default system phonebook for NT 3.51 is" & vbCrLf
- TempStr = TempStr & Chr$(34) & "C:\WINNT35\SYSTEM32\RAS\RASPHONE.PBK" & Chr$(34) & vbCr & vbCrLf
- TempStr = TempStr & "Enter the path and name of the phonebook, or press Cancel to abort." & vbCrLf
- mRAS1.PhoneBook = InputBox(TempStr, "Enter Phonebook", "C:\WINNT\SYSTEM32\RAS\RASPHONE.PBK")
- If mRAS1.PhoneBook = "" Then
- Exit Sub
- ElseIf Dir$(mRAS1.PhoneBook) = "" Then
- MsgBox "Unable to locate phonebook file: " & vbCrLf & mRAS1.PhoneBook
- Exit Sub
- End If
- On Error GoTo 0
- mRAS1.GetEntry
- End If
- ' Connect to server
- lstConnectState.Clear
- DisableControl cmdConnect
- DisableControl cmdRefresh
- DisableControl txtPhoneBook
- DisableControl lstEntries
- HideControl lblRefresh
- HideControl lblConnect
- ShowControl lblConnecting
- DoEvents
- mRAS1.Connect
- End Sub
- Private Sub cmdDisconnect_Click()
- ' Disconnect from server.
- mRAS1.Disconnect
- ' Enable appropriate controls
- EnableControl lstEntries
- DisableControl cmdDisconnect
- EnableControl cmdConnect
- HideControl lblDisconnect
- ShowControl lblConnect
- End Sub
- Private Sub cmdRefresh_Click()
- mRAS1.PhoneBook = txtPhoneBook
- mRAS1.Refresh
- LoadEntries
- lstEntries_Click
- HideControl lblConnect
- ShowControl lblSelect
- End Sub
- Private Sub Form_Load()
- ' Check for RAS services ...
- If (mRAS1.RASAvailable = False) Then
- MsgBox "RAS Services are not available. This program will not function without them.", vbOKOnly Or vbCritical, "Mabry RAS Dialer Sample"
- End
- End If
-
- ' Move to the upper left corner of the screen
- Me.Move 720, 720
- ' Load phone book entries from table
- LoadEntries
- End Sub
- Private Sub lstEntries_Click()
- If lstEntries.ListIndex = -1 Then
- DisableControl cmdConnect
- HideControl lblConnect
- ShowControl lblSelect
- Else
- EnableControl cmdConnect
- ShowControl lblConnect
- HideControl lblSelect
- End If
- End Sub
- Private Sub lstEntries_DblClick()
- ' Connect to the selected server.
- cmdConnect_Click
- End Sub
- Private Sub mRAS1_AsyncError(ErrorCode As Integer)
- If mRAS1.ConnectState = 8193 Then
- ' Not connected
- EnableControl cmdRefresh
- EnableControl txtPhoneBook
- ShowControl lblRefresh
-
- EnableControl cmdConnect
- EnableControl lstEntries
-
- HideControl lblConnecting
- ShowControl lblConnect
- End If
- End Sub
- Private Sub mRAS1_Done()
- ' Done with connection?
- If mRAS1.ConnectState = 8192 Then
- ' Connected
- EnableControl cmdRefresh
- EnableControl txtPhoneBook
- EnableControl cmdDisconnect
-
- ShowControl lblRefresh
- HideControl lblConnecting
- ShowControl lblDisconnect
- End If
- End Sub
- Private Sub mRAS1_Progress(ByVal ConnectState As Integer)
- lstConnectState.AddItem ConnectState & " " & mRAS1.ConnectStateString
- lstConnectState.ListIndex = lstConnectState.ListCount - 1
- End Sub
-